package com.bi.onlineEducation.web.controller;

import com.bi.onlineEducation.annotation.WebProcess;
import com.bi.onlineEducation.domain.RechargeLogPo;
import com.bi.onlineEducation.service.RechargeLogService;
import com.bi.onlineEducation.utils.ResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: chenYuTao
 * @Time: 2022/1/6 15:44
 * @Description: 基础数据控制层
 **/
@RestController
@Api(tags = "充值记录控制层", description = "充值记录数据接口")
public class RechargeLogController {

    @Resource
    private RechargeLogService rechargeLogService;

    @ApiOperation("查询所有")
    @WebProcess
    @GetMapping(value = "/rechargeLog/findAll")
    public ResultCode findAll() {
        return ResultCode.success(rechargeLogService.findAll());
    }

    @ApiOperation("根据id查询充值记录")
    @WebProcess
    @GetMapping(value = "/rechargeLog/findById")
    public ResultCode findById(@RequestParam("id") Integer id) {
        return ResultCode.success(rechargeLogService.findById(id));
    }

    @ApiOperation("保存信息")
    @WebProcess
    @PostMapping(value = "/rechargeLog/save")
    public ResultCode save(@RequestBody RechargeLogPo rechargeLogPo) {
        return ResultCode.success(rechargeLogService.save(rechargeLogPo));
    }

    @ApiOperation("根据id删除充值记录")
    @WebProcess
    @DeleteMapping(value = "/rechargeLog/deleteById")
    public ResultCode deleteById(@RequestParam("id") Integer id) {
        return ResultCode.success(rechargeLogService.deleteById(id));
    }


}